package com.example.demo.controller;

import com.example.demo.bean.Student;
import com.example.demo.dao.IStudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author zzy
 */
@Controller
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private IStudentDao iStudentDao;
 
    @RequestMapping("/selectAll")
    public String student(Model model) {

        List<Student> studentsList = iStudentDao.select(null);

        model.addAttribute("studentList",studentsList);

        return "home";
    }

    @RequestMapping("/addStudent")
    public String addStudent() {
        return "addStudent";
    }

}
